import cv2


def img_type(img):
    """检测图片类型"""
    h, w = img.shape[:2]
    # print(h, w)
    if h == w and h == 2048:
        return 2028
    elif h == w and h == 302:
        return 302
    else:
        return 0

if __name__ == '__main__':
    img = cv2.imread('../img/pic1.jpg', 0)
    if img is None:
        raise FileNotFoundError('../img/new/0012.tif')
    print(img_type(img))